<template>
	<view class="container" >
		<view>
			<view class="title">
				<text>平台推荐文章阅读 </text> <br />
				<text style="font-size: 19px;">阅读文章奖励积分</text>
			</view>
			<view>
				<hr size="1" class="linegee" />
			</view>
		</view>
		<view class="middle" v-if="loading">
			<view class="text" style="margin-top: 20px;">
				<view v-if="loadArticle" class="text">获取文章链接...</view>
				<view v-else class="text">任务进行中...</view>
			</view>
			<view class="windowlay">
				<view class="texting">
					<!-- <view id="finishNum"></view> -->
					<rich-text :nodes="pageReadData.message || '获取中，耐心等待...' "></rich-text>
				</view>
			</view>
		</view>
		<view class="showmessage">
			<view class="msgtitle">
				<b>温馨提醒:</b>
			</view>
			<view style="text-align: left;font-size: 16px;">
				每篇文章阅读至少需要<b>5</b>秒以上拉到页面底部点击【返回键】，
				<font color="red"><b>当前任务未完成，切记不要点左上角【X】关闭</b></font>，阅读完后自动阅读下一篇，直到提示任务完成。
			</view>
		</view>
		<view class="showmessage2">
			<view class="tiplay">
				<div class="tp">不要相信任何文章中的广告，不要在文章加</div>
				<div class="tp">任何人好友，任何投资都是骗人的，网上套</div>
				<div class="tp">路多，请千万注意</div>
			</view>
			<view class="tp-text">
				<!--<button class="btn" style="border:none;width:80%;background: #8fc9c6;font-size: 20px;padding: 10px;" id="returnBtn">返回用户中心</button>-->
				<p>&nbsp;</p>
			</view>
			<view class="tp-text">-- 已有 <span id="person">{{personNum||'300000'}}</span> 人领取成功 --</view>
		</view>
		<!-- 【弹窗-1、提醒操作弹层】 -->
		<view class="modelBox" v-if="isShowCenterTip" @touchmove.stop.prevent="moveHandle" @click="closeCenterTip()">
			<scroll-view scroll-y class="modelSheet">
				<view class="readtip" style="text-align: left;padding: 10px;">
					<view class="rtitle">【阅读提示】</view>
					<br />
					<view class="content">1、进入文章页，<text class="red-word">阅读5秒后点返回</text></view>
					<view class="content">2、自动阅读下一篇，继续<text class="red-word">点返回再阅读</text></view>
					<view class="content">3、每轮<text class="blue-word">{{pageReadData.everyArticleNum||28}}篇</text>
						文章，阅读完成自动结算 </view>
					<view class="content">4、关闭提示，系统会自动进入文章页<br /></view>
					<view class="content"><text class="red-word">【特别重要】阅读未完成，请勿关闭页面。</text></view>
					<br />
					<button class="confirm-btn" @click='' style="">知道了 (&nbsp;<b>{{pageReadData.leftSecond||0}}</b>秒后自动阅读)</button>
				</view>
			</scroll-view>
		</view>
		<!-- 【弹窗-END】 -->
		<view class="goback" style="background: #f7f7f7;  color: #e4e7ed; border: none;" @click="testRead()" v-if="pageDebugFlag">模拟阅读</view>
		<view>
			<!-- 文章提示窗 -->
			<uni-popup ref="loadArticleMessage" type="message">
				<uni-popup-message type="success" message="获取文章成功,开始阅读" :duration="3000"></uni-popup-message>
			</uni-popup>
			<!-- 结果提示窗 -->
			<uni-popup ref="alertDialog" type="dialog">
				<uni-popup-dialog :type="pageReadData.msgType" :duration="2000" :before-close="false" cancelText="关闭"
					confirmText="知道了" :title="pageReadData.showTitle || '请求数据失败'" :content="pageReadData.msgContent"
					@confirm="alertDialogClose" @close="alertDialogClose"></uni-popup-dialog>
			</uni-popup>
		</view>
	</view>
	<!-- 阅读文章功能 END -->
</template>
<script type="text/javascript">
	
</script>
<script>
	import CryptoJS from 'crypto-js'; 							// 引入crypto-js库
	import FingerprintJS from '@fingerprintjs/fingerprintjs';	//TODO引入外部指纹库
	export default {
		components: {
			CryptoJS
		},
		data() {
			return {
				loading: true,
				apiUrl: null,
				successUrl: '',
				isFirstIncome: false, 	//TODO 是否首次进来
				personNum: 8257989,		//TODO 初始用户数量
				readTimeSecond: 7, 		//TODO 时长为8秒（2025年1月6日修改为8秒）
				nowTimeStr: (new Date()).toLocaleString(), //TODO 毫秒值
				//TODO 文章请求：https://ydapi.plsvcrthcs.top/index/getArticleReading
				queryArticleApi: "/index/getArticleReading", 	//TODO 文章阅读接口
				queryReadStateApi: "/api/v1/User/getReadState", //TODO 状态数据上报
				//TODO 阅读结果显示
				pageReadData: {
					leftSecond:3,
					msgType: 'error',
					msgContent: '操作失败',
					showTitle: "操作提示",
					everyArticleNum: 28,
					message: "暂无数据",
				},
				currBeginIndex: undefined, //TODO 初始值当前获取文章值，存放缓存中， 再取出来 ; 
				myPageData: null,
				isShowCenterTip: false,
				loadArticle: false,
				pageDebugFlag:false,  	 //TODO 调试模式
				pageRequireMethod:false, //TODO 开启加密方案（默认为0：支持参数1-token加密,2-用key加密）
				pageSystemPrivateKey: undefined, //TODO 加密串数据
				beginTimer: undefined,
				pageReadRob: undefined, //TODO ROV变量
				pageReadUvk: undefined, //TODO 加密串数据
			};
		},
		onShow() {
			let _that = this;
			let isWechatAuth = false;
			let myBrowerInfo = window.performance;
			let myBrowerHeader = myBrowerInfo.navigation || null;
			let myBrowerType = myBrowerHeader.type || null;
			let myBrowerEventPersisted = event && event.persisted || null;
			let firstFbb = uni.getStorageSync('INPUT_ReadingFbb');
			let ENV_PlatForm = uni.getStorageSync('ENV_PlatForm');
			let randDom = Math.floor(Math.random() * 100);
			this.personNum = this.personNum + randDom;
			if(ENV_PlatForm=="h5"){
				this.$api.msg("请使用手机微信浏览器打开",5000);
				return ;
			}
			//1、首先判断是否微信内的浏览器, 自定义抛出异常【人数增长】
			this.$console("【onShow显示】加载 isWechatAuth，获取缓存FBB=>", isWechatAuth, firstFbb);
			this.$console("【PageShow】显示浏览器 myBrowerHeader,Type=" + myBrowerType, myBrowerHeader);
			this.onLoadFirstPrivate();  //TODO 动态参数引入
			//TODO 判断是否为返回进页面【event.persisted】和【window.performance && window.performance.navigation.type === 2】
			if (myBrowerType == 2) {
				this.isFirstIncome = false;
				this.isShowCenterTip = false;
				this.pageReadData.message = '<font color="red">正在获取文章...</font>';
				let firstIndex = uni.getStorageSync('ENV_FirstIncomeIndex');
				let addIndex = firstIndex + 1;
				this.$console("【onShow显示】页面显示数据中，加载数据FirstIndex=", firstIndex, this.isFirstIncome);
				uni.setStorageSync('ENV_FirstIncomeIndex', addIndex);
				//TODO 查看是否可以重启任务
				this.reBeginReadTask();
			} else {
				this.$console("【TIP】更新缓存FBB,并获取缓存数据 =>", firstFbb);
				this.isFirstIncome = true; 	//TODO 首次进来就清空
				uni.removeStorageSync('ENV_FirstIncomeIndex');
				uni.removeStorageSync('INPUT_ReadingParseMethod'); //TODO 清空数据
				this.$console("【onShow显示】首次进入OnLoad：清空ENV FirstIndex=", 0, this.isFirstIncome);
				uni.setStorageSync('ENV_FirstIncomeIndex', 0);
				//this.$api.msg("首次进入OnLoad：清空ENV"); 
				this.onLoadPageInParam(); 	//TODO 启动当前页面业务【文章阅读】
				this.apiUrl = this.getRequestApiPath();
				let isShowTIP = uni.getStorageSync('ENV_BeginShowCenterTIP');
				//TODO  仅首次进入，显示弹层
				this.isShowCenterTip = true;
				uni.setStorageSync('ENV_BeginTimeIntval',4);
				uni.setStorageSync('ENV_BeginShowCenterTIP',1);
				let tempTimer = setInterval(()=>{
					let SecondVal = uni.getStorageSync('ENV_BeginTimeIntval');
					this.$console("【TIP】每秒执行的定时器=>", SecondVal);
					if(SecondVal > 0){
						let SecondVal2=SecondVal-1;
						this.pageReadData.leftSecond=SecondVal2;
						uni.setStorageSync('ENV_BeginTimeIntval',SecondVal2);
					}else{
						clearInterval(tempTimer);
					}
				},1000);
				//TODO 异步方法执行处理
				this.beginTimer = setTimeout(() => {
					//TODO 启动文章阅读【3秒后】获取文章链接功能
					_that.isShowCenterTip = false;
					_that.queryArticleReading(true);
				}, 3550);
			}
		},
		//TODO 加载中
		onLoad(options) {
			this.loading = true;
			this.$console("[日志]-主程序开始",this.$ydsetdata);
			let DevInfo = this.$api.getSourceDevice();
			let myParam = this.parseRequestQuery();
			this.myPageData = myParam;
			this.$console("[首次]启动-onLoadPageFunc 动态参数param=>", this.apiUrl, this.myPageData);
			if (null !== DevInfo.platform && DevInfo.platform == "wechatMP" && DevInfo.isWechat === true) {
				//TODO  加载浏览器指纹
				this.beginFingerprintJs().then(result => {
					//TODO  获取浏览器的唯一标识
					if (undefined !== result.visitorId && null !== result.visitorId) {
						//this.$console("【获取当前浏览器标识】VisitorId:", result.visitorId);
						uni.setStorageSync('EnvBrowserVisitorId', result.visitorId);
					}
				}).catch(error => {
					console.error('获取当前浏览器标识】 Error:', error);
				});
				this.loading = true;
				/* window.addEventListener("popstate", function(e) { 
					alert("我监听到了浏览器的返回按钮事件啦");//根据自己的需求实现自己的功能 
				}, false); */ 
			} else {
				//this.loading = false;
				this.$console("【公共入口】请使用手机微信浏览器打开");
				setTimeout(() => {
					this.closeWxPage(); //TODO 关闭当前页面 
				},5000);
			}
		},
		methods: {
			//TODO 弹层窗口
			alertDialogClose() {
				this.$refs.alertDialog.close();
			},
			//TODO [动态]加密
			commEncryptAES(data,secretKey,ivChar){
				//TODO 加密方案；
				return this.$api.sysEncryptAES(data,secretKey,ivChar);  
			},
			//TODO 解密
			commDecryptAES(targetText,secretKey,ivChar) {
				//TODO 解密方案；
				return this.$api.sysDecryptAES(targetText,secretKey,null); 
			},
			//TODO 处理临时加密串
			CreateTempUnionId(tempFbb) {
				let initRandNumber = this.$ydsetdata.ac();	//TODO 基础配置值
				let tempUuid = this.$ydsetdata.bc(initRandNumber,tempFbb); //TODO 操作无效:$unionId
				return tempUuid;
			},
			//TODO 进行二次数据加密
			addCyJSSecValue(md5Key,method) {
				if(!method) { return md5Key; }
				let privateSec = this.pageSystemPrivateKey;
				let NewMD5Key = this.sysArticleAddEncryKey(md5Key,method,privateSec); 		//TODO 第二层方案
				if(null !== NewMD5Key && NewMD5Key!==false){
					return NewMD5Key;
				}
				return md5Key;
			},
			onLoadFirstPrivate() {
				//TOOD 引入功能 【TEMPSIGNNAME】
				let ivCharKey = this.$ydsetdata.sy();
				//this.$console("【加载配置】onLoadFirstPrivate " + ivCharKey);
				// TODO 引入配置
				if(undefined !== ivCharKey && null !== ivCharKey && ""!== ivCharKey && false !== ivCharKey){
					this.pageSystemPrivateKey = ivCharKey;
				}else{
					//TODO 默认签名：YIDIAN_PROPSIGN_SUDO
					this.pageSystemPrivateKey = atob('WUlESUFOX1BST1BTSUdOX1NVRE8=');
				}
			},
			//TODO 解析参数变更 
			onLoadPageInParam() {
				let _that = this;
				this.$console("【加载页面中】onLoadPageInParam 启动时间 Time=" + _that.nowTimeStr);
				//TODO传入外部的数据，需要先处理
				if (null !== this.myPageData && undefined !== this.myPageData.r && null !== this.myPageData.r && "" !== this.myPageData.r) {
					let tempSet = atob(this.myPageData.r) || null;
					let tempJson = tempSet ? JSON.parse(tempSet) : null;
					//this.$console("【加载页面中】解析参数传值：", tempJson);
					//TODO 外部数据传入，存入缓存中
					if (tempJson && undefined !== tempJson.t && null !== tempJson.t && false !== tempJson.t &&  tempJson.t !== "") {
						uni.setStorageSync('token', tempJson.t);
					}
					if (tempJson && undefined !== tempJson.k && null !== tempJson.k && false !== tempJson.k && tempJson.k !== "") {
						uni.setStorageSync('INPUT_ReadingUVK', tempJson.k);
					}
					if (tempJson && undefined !== tempJson.v && null !== tempJson.v && false !== tempJson.v && tempJson.v !== "") {
						uni.setStorageSync('INPUT_ReadingROB', tempJson.v);
					}
					//TODO解析数据，只允许首次进来才写入
					if (tempJson && undefined !== tempJson.b && null !== tempJson.b && tempJson.b !== "" && parseInt(tempJson.b) > 0) {
						uni.setStorageSync('INPUT_ReadingFbb', parseInt(tempJson.b));
					}
					//TODO解析数据，只允许首次进来才写入
					if (tempJson && undefined !== tempJson.vk && null !== tempJson.vk && false !== tempJson.vk && tempJson.vk !== "") {
						uni.setStorageSync('INPUT_ReadingVKD', tempJson.vk);
					}
					if (tempJson && undefined !== tempJson.api && null !== tempJson.api && false !== tempJson.api && tempJson.api !== "") {
						uni.setStorageSync('EnvRequestAPIURL', tempJson.api);
					}
					if (tempJson && undefined !== tempJson.d && null !== tempJson.d && tempJson.d !== "" && parseInt(tempJson.d)==1) {
						this.pageDebugFlag=true;
					}
					//手动设置加密方案： this.pageRequireMethod=3;
					if (tempJson && undefined !== tempJson.g && null !== tempJson.g && tempJson.g !== "" && parseInt(tempJson.g) >= 0) {
						this.pageRequireMethod=parseInt(tempJson.g);
						uni.setStorageSync('INPUT_ReadingParseMethod', this.pageRequireMethod); //TODO 重写方案值
					}
					//TODO 是否有数据需要解密
					if (tempJson && undefined !== tempJson.data && null !== tempJson.data && false !== tempJson.data && tempJson.data !== "" && tempJson.data.length>0) {
						//TODO 数据解密
						let decData = this.sysParseUserData(tempJson.data);
						let parseChild = decData.childOption || null;
						//this.$console("【GET-解密】解密结果返回数据：", parseChild, decData); 
						//TODO ROB数据
						if (decData && undefined !== decData.mdstr && null !== decData.mdstr && false !== decData.mdstr && decData.mdstr !== "") {
							uni.setStorageSync('INPUT_ReadingROB', decData.mdstr);
						}
						//TODO签名数据
						if (decData && undefined !== decData.signk && null !== decData.signk && false !== decData.signk && decData.signk !== "") {
							uni.setStorageSync('INPUT_ReadingVKD', decData.signk);
						}
						if (parseChild && undefined !== parseChild.userFbb && null !== parseChild.userFbb && parseChild.userFbb > 0) {
							uni.setStorageSync('INPUT_ReadingFbb', parseChild.userFbb);
						}
						if (parseChild && undefined !== parseChild.uvkey && null !== parseChild.uvkey && false !== parseChild.uvkey &&  parseChild.uvkey !== "") {
							uni.setStorageSync('INPUT_ReadingUVK', parseChild.uvkey);
						}
						//TODO 重写方案值
						if (parseChild && undefined !== parseChild.usdMethod && null !== parseChild.usdMethod && parseChild.usdMethod >= 0) {
							this.pageRequireMethod=parseInt(parseChild.usdMethod);
							uni.setStorageSync('INPUT_ReadingParseMethod', this.pageRequireMethod); 
						}
					}
				}
				
				//TODO 初始化基础脚本数据；（动态引入改轮数据内容FFB）
				let ReadingFbb = uni.getStorageSync('INPUT_ReadingFbb');
				let ReadingUVK = uni.getStorageSync('INPUT_ReadingUVK');
				let ReadingROB = uni.getStorageSync('INPUT_ReadingROB');
				let ReadingVKD = uni.getStorageSync('INPUT_ReadingVKD');
				let ReadingParseMethod = uni.getStorageSync('INPUT_ReadingParseMethod');
				
				//TODO 动态引入基础数据
				this.$console("【加载页面中】INPUT_ReadingParseMethod 获取解密方案=>", ReadingParseMethod);
				//this.$console("【加载页面中】ReadingFbb 获取数据内容=>", ReadingFbb);
				//this.$console("【加载页面中】ReadingUVK 获取数据内容=>", ReadingUVK);
				//this.$console("【加载页面中】ReadingROB 获取数据内容=>", ReadingROB);
				//this.$console("【加载页面中】ReadingVKD 获取数据内容签名数据=>", ReadingVKD);
				
				//TODO 加密测试
				//let enData = this.commEncryptAES(this.myPageData,TEMPSIGNNAME,ivChar);
				//this.$console("【GET-VALUE】加密数据 => " + TEMPSIGNNAME, enData);
				//let decText = '0NCevobt3Vk74JW8xmUZ91l6xmVyOncBGP2POvAzzT3IUwjwE6n5RO8TLT1wbo5j';
				//let ivChar = atob('GjygKOjlhNGbwlRitpE3Hg==');
				//this.$console("【GET-VALUE】解密ivChar=> " + ivChar);
				//let decData = this.commDecryptAES(enData,TEMPSIGNNAME,ivChar);
				//this.$console("【GET-VALUE】解密码数据=> " + TEMPSIGNNAME, decData);
			},
			getNowSeconds() {
				let newStamp2 = (new Date()).getTime();
				let mySecond = Math.floor(newStamp2 / 1000); //TODO获取秒数据
				return mySecond;
			},
			//TODO 关闭弹窗，立即进入页面
			closeCenterTip() {
				this.isShowCenterTip = false;
				if (undefined !== this.beginTimer && null !== this.beginTimer && this.beginTimer > 0) {
					clearTimeout(this.beginTimer);
					this.$console("【TIP】closeCenterTip，清空定时器=>" + this.beginTimer);
					this.beginTimer = undefined;
				}
				this.queryArticleReading(true); //TODO 直接进入文章阅读
			},
			//TODO 清空缓存 
			clearLocalStorage(){
				uni.removeStorageSync('token');
				this.$console("【TIP】clearLocalStorage，清空本地所有缓存");
				uni.removeStorageSync('ENV_PlatForm');
				uni.removeStorageSync('ENV_ReaderVersion');
				uni.removeStorageSync('INPUT_ReadingVKD');
				uni.removeStorageSync('ENV_BeginTimeIntval');
				uni.removeStorageSync('ENV_FirstIncomeIndex');
				uni.removeStorageSync('EnvRequestAPIURL');
				uni.removeStorageSync('INPUT_ReadingUVK');
				uni.removeStorageSync('INPUT_ReadingROB');
				uni.removeStorageSync('EnvRequestBeginTime');
				uni.removeStorageSync('ENV_BeginShowCenterTIP');
				uni.removeStorageSync('INPUT_ReadingParseMethod');
				return true;
			},
			//TODO 加载浏览器指纹包数据
			async beginFingerprintJs() {
				//TODO  创建一个新的FingerprintJS实例
				const fp = await FingerprintJS.load();
				return await fp.get();
			},
			//TODO 获取接口地址；
			getRequestApiPath() {
				let initUrl = getApp().globalData.url;
				let cacheUrl = uni.getStorageSync("EnvRequestAPIURL");
				if (undefined !== cacheUrl && null !== cacheUrl && "" !== cacheUrl) {
					return cacheUrl;
				} else {
					uni.setStorageSync("EnvRequestAPIURL", initUrl);
				}
				return initUrl;
			},
			//TODO临时算法
			getTempValalue(tempYushu,tempFbb){
				//TODO 获取数据
			    let tempAddSecValue = this.$ydsetdata.sc(tempFbb,tempYushu); 
				/* let tempAddSecValue = 0;
				if (tempYushu >= 5 && tempYushu <= 12) {
					tempAddSecValue = tempFbb * 899;
				} else if (tempYushu > 12 && tempYushu <= 15) {
					tempAddSecValue = tempFbb * 1018;
				} else if (tempYushu > 15 && tempYushu <= 20) {
					tempAddSecValue = tempFbb * 1024;
				} else {
					tempAddSecValue = tempFbb + 8000;
				} */
				return tempAddSecValue;
			},
			
			//重启任务
			reBeginReadTask() {
				//TODO 查看文章阅读的时长，是否满足5秒钟，
				let newStamp = this.getNowSeconds();
				let historyTime = uni.getStorageSync("EnvRequestBeginTime");
				let SuccFileUrl = uni.getStorageSync('INPUT_ReadingURL');
				let leftLong = newStamp - historyTime;
				this.$console("【TIP】检测是否可以重启任务(5秒内),开始时间： " + historyTime +"；当前时间："+newStamp+"；相隔时长=>", leftLong , SuccFileUrl);
				//TODO 有效时间内，可以下一轮
				if (historyTime && historyTime > 0 && leftLong > this.readTimeSecond) {
					//this.$console("【TIP】可以阅读下一篇文章 => queryArticleReading");
					this.queryArticleReading(true);  //TODO 继续阅读新一篇
					return;
				}
				this.$console("【TIP】阅读时长不足5秒,重新阅读=> ", SuccFileUrl);
				this.$api.msg("阅读不足5秒钟", 2500, false, 'error'); //TODO 阅读时间还不够；
				if (null !== SuccFileUrl && SuccFileUrl !== "") {
					setTimeout(() => {
						let nowSecc = this.getNowSeconds();
						uni.setStorageSync("EnvRequestBeginTime", nowSecc);
						this.jumpPage(SuccFileUrl);
					}, 1000);
				} else {
					setTimeout(() => {
						this.queryArticleReading(true); //TODO 继续阅读新一篇
					}, 3000);
				}
				return;
			},

			//TODO 文章阅读功能【主体功能】 
			queryArticleReading(jumpFlag) {
				this.loadArticle = true;
				let newStamp   = (new Date()).getTime();
				let apiUrl2    = this.getRequestApiPath();
				let requestApi = apiUrl2 + this.queryArticleApi;
				let userToken  = uni.getStorageSync('token');
				let ReadingUVK = uni.getStorageSync('INPUT_ReadingUVK');
				let ReadingROB = uni.getStorageSync('INPUT_ReadingROB');
				let ReadingFbb = uni.getStorageSync('INPUT_ReadingFbb');
				let ReadingVKD = uni.getStorageSync('INPUT_ReadingVKD');//TODO 传进来的MD5加密签名
				let BrowserVisitorId = uni.getStorageSync('EnvBrowserVisitorId');
				let ReadingParseMethod = uni.getStorageSync('INPUT_ReadingParseMethod');
				let requestParam = {
					"startNumber": 0,
					"unionId": 0,
					"fvkd":"",
					"fvsign":"",
					"str": ReadingROB,
				};
				this.$console("【TIP】获取在线身份TOKEN =>" + userToken, ReadingROB, ReadingUVK,ReadingParseMethod);
				if (!userToken || !ReadingROB) {
					this.showErrorMessage("身份信息验证失败，请重试", 10000);
					//TODO 临时TOKEN uni.setStorageSync("token","58546ab2146fc29b300e5471e7041743a35e1856");
				}
				//TODO 临时数据值，
				//this.$console("【TIP】执行文章阅读,关闭定时器Timer =>" + this.beginTimer, newStamp);
				//this.$console("【TIP】执行文章pageReadUvk =>" + ReadingUVK);
				//this.$console("【TIP】执行文章pageReadRob和Fbb =>" + ReadingFbb, ReadingROB);
				//ReadingFbb=45;
				//this.pageReadUvk="MMEErDED";
				//this.pageReadRob='Bz9WMVMsVzEAY1c0BWdUZFw2AjtQbwU2DmxQfwRjATpTbVY1';
				//TODO 基础数据验证，就关闭窗口
				if (!ReadingROB || !ReadingUVK || null === ReadingFbb || parseInt(ReadingFbb) <= 0) {
					this.showErrorMessage("请求错误，请尝试重新打开链接", 10000);
					return;
				}
				//TODO 临时码更新
				let addUnionId = this.CreateTempUnionId(ReadingFbb); //TODO 临时码算法
				//TODO 串码更新
				let addMd5Sec = this.CreateInputMd5UVKSec(ReadingFbb, ReadingROB, ReadingUVK); //TODO 获取MD5加密串
				if (!addUnionId || !addMd5Sec) {
					this.showErrorMessage("阅读链接无效，请重新获取链接", 10000);
					return;
				}
				//TODO 处理清空
				uni.removeStorageSync('INPUT_ReadingFbb'); //TODO 清空数据
				uni.removeStorageSync('INPUT_ReadingURL'); //TODO 清空数据
				//TODO 请求文章数据
				requestParam.inputId = 0;
				requestParam.unionId = addUnionId; //TODO 临时码更新
				requestParam.vt = BrowserVisitorId;
				requestParam.keys = addMd5Sec;
				//TODO 处理加密串
				let usedParseMethod = parseInt(ReadingParseMethod);
				//TODO 二次数据加密方案
				if(undefined  !== usedParseMethod && usedParseMethod >= 1){
					let secMdKey = this.addCyJSSecValue(addMd5Sec,usedParseMethod); 
					requestParam.keys = secMdKey?secMdKey:addMd5Sec; 
				}
				//TODO 要签名数据
				if(null !== ReadingVKD && false !== ReadingVKD && ReadingVKD!=="" ){
					requestParam.fvsign = ReadingVKD;
					requestParam.fvkd = this.$md5(ReadingVKD);
				}
				//TODO 系统模式
				if(this.pageDebugFlag===true){
					jumpFlag = false;
				}
				this.$console("【TIP】请求文章接口和是否跳转链接：" + requestApi,jumpFlag, requestParam);
				//TODO 接口请求新文章内容
				this.$api.request({
					url: requestApi,
					method: 'GET',
					data: { ...requestParam },
					success: res => {
						this.loadArticle = false;
						let httpCode = res.code || 0;
						let resData = res.data || null; //TODO 成功数据
						this.$console("【TIP】请求文章返回=>", res);
						//TODO 第一层
						if (httpCode == 200 && null !== resData && undefined !== resData) {
							let dataCode = resData.code || 0;
							let showMessage = resData.message || '';
							let succFbb = resData.ffb || 0; //TODO 成功数据
							let finishNum = resData.startNum || 0; //TODO 成功数据
							let succUrl = resData.url || ''; //TODO 文章地址 
							let inputbbc = resData.inputbbc || 0; //是否要上报数据
							this.$console("【TIP】请求接口文章返回=>", resData);
							let nowSecc = this.getNowSeconds();
							//TODO 文章获取成功，
							if (dataCode == 200 && null !== succUrl && succUrl !== "") {
								this.pageReadData.msgType = 'success';
								this.pageReadData.msgContent = "获取文章成功,正在跳转...";
								this.pageReadData.message = '<font color="red">获取文章成功</font>';
								if (finishNum > 0) {
									this.pageReadData.message = '<font color="red">成功' + finishNum + '篇，继续阅读...</font>';
								}
								uni.setStorageSync('INPUT_ReadingFbb', succFbb);
								uni.setStorageSync('INPUT_ReadingURL', succUrl); //TODO 成功文章地址
								let cacheFbb = uni.getStorageSync('INPUT_ReadingFbb');
								this.$console("【TIP】更新缓存FBB,并获取缓存数据=>当前时间秒:" + nowSecc, succFbb, cacheFbb);
								uni.setStorageSync("EnvRequestBeginTime", nowSecc);
								this.$refs.loadArticleMessage.open('bottom');
								if (jumpFlag === true) {
									this.jumpPage(succUrl);
								}
								return;
							} else if (dataCode == 300) {
								//TODO 任务已完成
								this.showFinishMessage("已完成", "任务已完成，请返回。");
								return;
							} else if (dataCode == 299) {
								this.clearLocalStorage();//TODO 本地版本过低,清空缓存
								this.showFinishMessage("系统版本更新提醒", "检测到新版本更新，请重试。", 'warning');
								return;
							} else {
								this.showErrorMessage(showMessage, dataCode);
								return;
							}
						} else {
							this.showErrorMessage("系统异常，请重新打开链接", httpCode);
							return; //TODO 失败消息提醒
						}
					},
					complete: error => {
						this.loadArticle = false;
						this.$console("【TIP】请求文章失败 => ", error);
						uni.showToast({ title: '系统异常,请重试', icon: 'none' });
						return false;
					}
				});
			},
			//TODO 第一层
			firstAddVal(tempAddSecValue,mdStrRov,signName) {
				let myChar1 = atob('TUQ1Xw==');
				let myChar2 = atob('X1JPVjo=');
				let FullChar = myChar1+tempAddSecValue; 
				if(null !== mdStrRov){
					FullChar = FullChar+myChar2+mdStrRov;
				}
				if(null !== signName){
					FullChar = FullChar+"&MYCODE="+signName;
				}
				let firstMd5 = this.$md5(FullChar);
				//this.$console("【firstAddVal】加密值:" + tempAddSecValue + "和第一层加密字符=>" + firstMd5, FullChar);
				return firstMd5;
			},
			//TODO 第二层
			secondAddVal(tempMd5,tempYushu,md5Secret) {
				let myChar1 = atob('X1JBTkRf');
				let myChar2 = atob('UFJJS0VZ');
				let FullChar = tempMd5+myChar1; 
				if(null !== tempYushu){
					FullChar = FullChar+tempYushu;
				}
				if(null !== md5Secret){
					FullChar = FullChar+"&"+myChar2 +"="+md5Secret;
				}
				let lastMd5 = this.$md5(FullChar);
				//this.$console("【secondAddVal】加密余数:" + tempYushu + "和第二层加密字符=>" + lastMd5, FullChar);
				return lastMd5;
			},
			//TODO 处理临时加密串
			CreateInputMd5UVKSec(tempFbb, mdStrRov, md5Secret) {
				let base64Char = 'SllNTDIwMjQwOTMw'; 	//TODO 解码值
				let signName = atob(base64Char); 		//TODO 解码字符串
				let tempYushu = parseInt(tempFbb) % 20; //TODO 取值20的余数数据
				//TDOO 临时数据
				let tempAddSecValue = this.getTempValalue(tempYushu,tempFbb);
				//TDOO 加密验证算法功能 ；
				let tempMd5 = this.firstAddVal(tempAddSecValue,mdStrRov,signName);
				let md5DecodeValue = this.secondAddVal(tempMd5,tempYushu,md5Secret); //TODO 双层MD5加密KEY值
				//this.$console("【CreateInputMd5UVKSec】加密值:" + tempAddSecValue + "和第一层加密串=>", tempMd5 + "_RAND_" + tempYushu, md5DecodeValue);
				return md5DecodeValue;
			},
			//TODO 完成消息
			showFinishMessage(title, showMessage,msgtype) {
				this.pageReadData.showTitle = title ? title : '操作提示';
				this.pageReadData.msgType = 'success';
				this.pageReadData.msgContent = showMessage;
				this.pageReadData.message = '<font color="green">' + showMessage + '</font>';
				this.$refs.alertDialog.open();
				setTimeout(()=>{ 
					this.closeWxPage();
				},5000);
			},
			
			//TODO 错误消息
			showErrorMessage(showMessage, errorCode) {
				this.pageReadData.msgType = 'error';
				this.pageReadData.showTitle = '操作失败';
				this.pageReadData.msgContent = showMessage;
				this.pageReadData.message = '<font color="red">获取文章失败</font>';
				this.$refs.alertDialog.open();
				let sleepTime = (errorCode==112) ?5000:3580;
				setTimeout(() => {
					this.loadArticle = false;
					this.$refs.alertDialog.close();
					if (errorCode == 10000 || errorCode==501 || errorCode== 110 || errorCode== 101 || errorCode== 112) {
						//TODO 关闭当前页面
						this.closeWxPage(); 
					}
				}, sleepTime);
			},
			//TODO 请求参数解析值【分析请求参数】
			parseRequestQuery() {
				const res = {};
				const search = new URLSearchParams(window.location.search);
				search.forEach((value, key) => {
					let arr = res[key];
					if (arr === undefined) {
						arr = res[key] = value;
					} else if (Array.isArray(arr)) {
						arr.push(value);
					} else {
						res[key] = [arr, value];
					}
				});
				return res;
			},
			//TODO 模拟阅读
			testRead() {
				let FileUrl =
					"http://mp.weixin.qq.com/s?__biz=MzAwNzIwNzIyMg==&mid=2665879340&idx=1&sn=4a55d042380bbde45723525b9213504e&scene=0#wechat_redirect";
				this.jumpPage(FileUrl);
			},
			//TODO 关闭微信内的页面
			closeWxPage() {
				if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
					WeixinJSBridge.call('closeWindow')
				}
			},
			//TODO 跳转出去页面
			jumpPage(url) {
				this.$console("【jumpPage】跳转出去", url);
				var domEle = document.createElement('a');
				domEle.setAttribute("rel", "noreferrer");
				domEle.setAttribute("href", url);
				document.body.appendChild(domEle);
				domEle.click();
				document.body.removeChild(domEle);
				/* setTimeout(() => { window.location.href = url; }, 800); */
				return;
			}
		}
	};
</script>

<style lang="scss">
	page,
	.container {
		text-align: center;
		padding-bottom: 540rpx;
		background: linear-gradient(to bottom, #3287e3 25%, #94a6df 75%);
		width: 100%;
		min-height: 100%;
		text-align: center;
		position: relative;

		.title {
			color: rgb(255, 255, 255);
			font-size: 24px;
			font-weight: 800;
			line-height: 40px;
			letter-spacing: 3px;
			padding-top: 20px;
			margin-top: 20px;
		}

		.linegee {
			background: hsla(0, 0%, 100%, .95);
			width: 70%;
			margin: 5px auto;
			height: 1px;
			border: none;
		}

		.middle {
			display: block;
			margin: 10px auto;

			.text {
				color: #fff;
				font-size: 16px;
				font-weight: bold;
			}

			.windowlay {
				display: inline-flex;
				margin-top: 20px;
				padding: 7px;
				background-color: #fff;
				border-radius: 60px;
				box-shadow: 3px 4px 2px #007aff;

				.texting {
					width: 204px;
					height: 50px;
					line-height: 50px;
					font-size: 15px;
				}
			}
		}

		.showmessage {
			border-radius: 10px;
			background-color: #fff;
			padding: 20px;
			color: #000;
			width: 90%;
			margin: 10px auto;
			margin-top: 70px;
			margin-bottom: 10px;
			line-height: 25px;

			.msgtitle {
				text-align: left;
				line-height: 30px;
				color: red;
				font-size: 18px;
			}
		}

		.showmessage2 {
			font-size: 16px;
			margin-top: 30px;

			.tiplay {
				color: rgb(168, 0, 250);
				font-weight: 800;
				margin-top: 10px;
				margin-bottom: 40px;
			}

			.tp-text {
				color: #fff;
				font-size: 16px;
				font-weight: bold;
			}
		}
	}

	.modelBox {
		position: fixed;
		z-index: 998;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, 0.3);
		display: flex;
		align-items: center;
		justify-content: center;

		.modelSheet {
			width: 80%;
			background-color: #FFF;
			text-align: center;
			border-radius: 16upx;
			overflow: hidden;
			padding: 10px;
			;
		}

		.mode-h1 {
			margin-top: 40upx;
		}

		.readtip {
			text-align: left;
			padding: 10px 12px;
			font-size: 15px;
			line-height: 21px;

			.rtitle {
				text-align: center;
				font-size: 18px;
				color: red;
				font-weight: 800;
			}
			.content {
				line-height: 24px;
				font-size: 15px;
				.red-word {color:red; font-weight:bold; }
				.blue-word {color:#3287e3; font-weight:bold; }
			}
			
			.confirm-btn {
				width:185px;
				font-size: 13px;
				color:royalblue;
				height:28px;
				line-height: 28px;
			}
		}
	}

	.bg {
		width: 700upx;
		margin: 20upx auto;
		height: 1304upx;
	}
</style>